48ba4871a75515fa56c88d0996231782339e9204,opennms-services/src/main/java/org/opennms/netmgt/linkd/DbEventWriter.java,DbEventWriter,storeSnmpCollection,#Connection#Timestamp#,371

Before Change



				// info used for Discovery Link
				RouterInterface routeIface = new RouterInterface(ifindex);
				routeIface.setMetric(routemetric1);
				routeIface.setNextHop(nexthop);
				
				

After Change


				int ifindex = ent.getInt32(IpRouteTableEntry.IP_ROUTE_IFINDEX);
                log.debug("storeSnmpCollection: ifindex is: "+ (ifindex < 1 ? "less than 1" : ifindex)+"; IP_ROUTE_IFINDEX: "+IpRouteTableEntry.IP_ROUTE_IFINDEX);

                if (ifindex < 0) {
					log.warn("store: NNot valid ifindex" + ifindex 
							+ " Skipping...");
					continue;
				}
                
				int routemetric1 = ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC1);
                log.debug("storeSnmpCollection: routemetric1 is: "+ (routemetric1 < 1 ? "less than 1" : routemetric1)+"; IP_ROUTE_METRIC1: "+IpRouteTableEntry.IP_ROUTE_METRIC1);
                
                log.debug("storeSnmpCollection: ent="+ent);
                log.debug("storeSnmpCollection: IP_ROUTE_METRIC2="+IpRouteTableEntry.IP_ROUTE_METRIC2);
				int routemetric2 = ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC2);
                log.debug("storeSnmpCollection: routemetric2 is: "+ (routemetric2 < 1 ? "less than 1" : routemetric2)+"; IP_ROUTE_METRIC2: "+IpRouteTableEntry.IP_ROUTE_METRIC2);
                
				int routemetric3  =ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC3);
                log.debug("storeSnmpCollection: routemetric3 is: "+ (routemetric3 < 1 ? "less than 1" : routemetric3)+"; IP_ROUTE_METRIC3: "+IpRouteTableEntry.IP_ROUTE_METRIC3);
                
				int routemetric4 = ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC4);
                log.debug("storeSnmpCollection: routemetric4 is: "+ (routemetric4 < 1 ? "less than 1" : routemetric4)+"; IP_ROUTE_METRIC4: "+IpRouteTableEntry.IP_ROUTE_METRIC4);
                
				int routemetric5 = ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC5);
                log.debug("storeSnmpCollection: routemetric5 is: "+ (routemetric5 < 1 ? "less than 1" : routemetric5)+"; IP_ROUTE_METRIC5: "+IpRouteTableEntry.IP_ROUTE_METRIC5);
                
				int routetype = ent.getInt32(IpRouteTableEntry.IP_ROUTE_TYPE);
                log.debug("storeSnmpCollection: routetype is: "+ (routetype < 1 ? "less than 1" : routetype)+"; IP_ROUTE_TYPE: "+IpRouteTableEntry.IP_ROUTE_TYPE);
                
				int routeproto = ent.getInt32(IpRouteTableEntry.IP_ROUTE_PROTO);
                log.debug("storeSnmpCollection: routeproto is: "+ (routeproto < 1 ? "less than 1" : routeproto)+"; IP_ROUTE_PROTO: "+IpRouteTableEntry.IP_ROUTE_PROTO);
                

				// info used for Discovery Link
				
				
				RouterInterface routeIface = null;
				routeIface = getNodeidMaskFromIp(dbConn,nexthop);

				// if target node is not snmp node try to save info
				if (routeIface == null) {
					routeIface = getNodeFromIp(dbConn, nexthop);
				}
					
				if (routeIface == null) {
					//TODO here is a good point for autodiscovery
					log.warn("store: No nodeid found for next hop ip" + nexthop 
							+ " Skipping ip route interface add to Linkable Snmp Node");
					// try to find it in ipinterface
				} else {
					int snmpiftype = -2;
					if (ifindex > 0) snmpiftype = getSnmpIfType(dbConn, nodeid, ifindex);

					// no processing ethernet type
					if (log.isDebugEnabled())
						log.debug("store: interface has snmpiftype "
									+ snmpiftype + " . Adding to DiscoverLink ");

					routeIface.setSnmpiftype(snmpiftype);
					routeIface.setIfindex(ifindex);
					routeIface.setMetric(routemetric1);
					routeIface.setNextHop(nexthop);
						
					routeInterfaces.add(routeIface);